<template>
	<view>
		<view class="search">
			<u-search :show-action="false" :input-style="{'font-size':'12px','margin-left':'20px'}" @click="gotosearch"
				bg-color="#ffffff" :disabled="true" placeholder="输入你的家乡"></u-search>
		</view>
		<view class="hot-place">
			<u-grid :col="2" :border="false">
				<u-grid-item v-for="(item,index) in dataList">
				<image @click="logoTap(item)" style="width:345upx; height:280upx;border-radius: 15upx;"
						:src="item.cover_url" :key="index">
					</image>
					<view class="">
						{{item.title}}
					</view>
					<view class="text-gray u-font-sm test_demo u-p-l-10 ">
						{{item.address}}
					</view>
				</u-grid-item>

			</u-grid>
		</view>

	</view>
</template>

<script>
	import alldata from '../../data/homes.json'
	export default {
		data() {
			return {
				dataList: [],
			}
		},
		onShow() {

		},
		mounted() {
			this.dataList = alldata
		},
		methods: {
			gotosearch() {
				uni.navigateTo({
					url: '/pages/search/search'
				})
			},
			logoTap(item) {
				let that = this
				if (!that.$store.state.vuex_token) {
					that.$u.toast('请先登录')
					that.$u.debounce(() => {
						that.$goWindow('/pages/login/login')
					}, 1500)
					return
				}
				if (!that.$store.state.vuex_user.vip) {
					that.$u.toast('会员才可查看')
					that.$u.debounce(() => {
						that.$goWindow('/pages/vip/vip')
					}, 1500)
					return
				}
				let points = item.point.split(',')
				uni.navigateTo({
					url: `../showMap/showMap?title=${item.title}&lng=${points[0]}&lat=${points[1]}`
				})
				// uni.navigateTo({
				// 	url: `/pages/webview/webview?url=${item.jingdian_url}&title=${item.jingdian_name}`
				// })
			}
		}
	}
</script>
<style lang="scss">
	.hot-place {
		width: 100%;
		background-color: #FFFFFF;

	}

	.test_demo {
		letter-spacing: 0;
		overflow: hidden;
		display: -webkit-box;
		text-overflow: ellipsis;
		-webkit-line-clamp: 2;
		/*要显示的行数*/
		-webkit-box-orient: vertical;
		font-size: 12px;
	}

	.search {

		padding: 20upx 20upx;
		box-sizing: border-box;
	}
</style>
